package fr.fort.lycee.spring.daoImpl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import fr.fort.lycee.spring.dao.IDaoInscription;
import fr.fort.lycee.spring.entities.Inscription;
@Repository
@Transactional
public class DaoInscriptionImpl implements	IDaoInscription {
	
	@PersistenceContext
	private EntityManager em;

	public Integer save(Inscription inscription) {
		em.persist(inscription);
		return inscription.getIdInscription();
	}

	public void update(Inscription inscription) {
		em.merge(inscription);
	}

	public void delete(Inscription inscription) {
		em.remove(inscription);
	}

	public Inscription findById(int id) {
		Inscription retour = em.find(Inscription.class, id);
		return retour;
	}

	@Override
	public List<Inscription> findAll() {
		// TODO Auto-generated method stub
		return null;
	}
}
